#!/bin/ash

host=$MYSQL_PORT_3306_TCP_ADDR
pass=$MYSQL_PASSWORD
user=$MYSQL_USERNAME
db=$MYSQL_INSTANCE_NAME

sed -i "s/mysqlhost/$host/" /www/sqli/db.php
sed -i "s/mysqluser/$user/" /www/sqli/db.php
sed -i "s/mysqlpass/$pass/" /www/sqli/db.php
sed -i "s/mysqldb/$db/" /www/sqli/db.php

if [[ -z $host -o -z $pass -o -z $user -o -z $db ]];then echo "Cannot reach Mysql"; exit; fi

echo "Mysql: host: $host pass: $pass user: $user dbname: $db"

httpd

tail -f /var/log/apache2/error.log
